package zlatan_demo05_array

object ClassDemo04 {

  def main(args: Array[String]): Unit = {
    val arr1 = Array(1, 2, 3, 4, 5)
    //通过索引获取元素
    //to 包左也包右(0,1.txt,2,3,4,5)
    for (i <- 0 to arr1.length - 1) println(arr1(i))
    println("-" * 15)
    //until 包左不包右(0,1.txt,2,3,4)
    for (i <- 0 until arr1.length) println(arr1(i))
    println("-" * 15)
    //通过元素直接获取
    //I表示数组中的元素
    for (i<-arr1)println(i)

  }
}
